package com.fzhucc.modules.businessCard.repository;

import com.fzhucc.modules.businessCard.domain.BusinessCard;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
* @website https://eladmin.vip
* @author yyg
* @date 2022-10-24
**/
public interface BusinessCardRepository extends JpaRepository<BusinessCard, Integer>, JpaSpecificationExecutor<BusinessCard> {
    @Query("SELECT a from BusinessCard as a where a.userId=:userId")
    BusinessCard findByUserid(Long userId);

    @Query("SELECT a from BusinessCard as a where a.phone=:phone and a.userId=:userId")
    List<BusinessCard> findByPhoneWithUserId(String phone,Long userId);
}